package leecode

func insertIntoBST(root *TreeNode, val int) *TreeNode {
	//遇到空节点 , 插入即可
	if root == nil {
		result := TreeNode{Val: val}
		return &result
	}
	if root.Val > val {
		//左侧
		root.Left = insertIntoBST(root.Left, val)
	} else {
		//右侧
		root.Right = insertIntoBST(root.Right, val)
	}
	return root
}
